-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add FAST GetAttribute methods. #1
base: master
Are you sure you want to change the base?
Conversation
Thank you for your PR! I like your attribute caching approch. However, I have two questions. Questions
|
OK. I will add it.
I usually use original attributes for extend enum. enum FileTypes
{
[FileExt(".txt"), Description("Full text"), CanRead, CanWrite]
FullText,
[FileExt(".txt"), Description("Simple text: can't read"), CanWrite]
SimpleText,
[FileExt(".mybin2"), Description("my original format"), CanRead, CanWrite]
Binary,
[FileExt(".mybin"), Description("my old original format"), CanRead, CanWrite, Obsolete]
OldBinary,
}
//At file save dialog
FastEnum.GetValues<FileTypes>()
.Where(x => x.GetAttribute<FileTypes, CanWrite>() != null)
.Where(x => x.GetAttribute<FileTypes, Obsolete>()==null)
.Select(x =>
(
x.GetAttribute<FileTypes, FileExtAttribute>().FileExt,
x.GetAttribute<FileTypes, DescriptionAttribute>().Description
))
.Select((a) =>$"{a.Description} (*{a.FileExt})|*{a.FileExt}")
//create Filter of dialg |
I added GetAttribute"s" methods. This is Benchmark.
|
I think almost ok. However I'm considering about a better way now. Please wait for a while. |
Hi,
This PR is adding fast GetAttribute methods.
How to use
Benchmark